<script setup>
import { Search } from '@element-plus/icons-vue';
import ItemContainerCard from './item-container-card.vue';

const cities = [{
  id: '1',
  title: '甘肃省xxx设计项目A',
  circle: '2023/01/01—2023/04/01',
  auditDepartment: 'A省公司/A1部',
  doDepartment: 'A省公司/B2',
  person: '张嘉乐',
},
{
  id: '2',
  title: '甘肃省xxx设计项目A',
  circle: '2023/01/01—2023/04/01',
  auditDepartment: 'A省公司/A1部',
  doDepartment: 'A省公司/B2',
  person: '张嘉乐',
}];
const tabBtn = [
  {
    label: '全部',
    name: 'all',
    icon: 'ep:menu',
  },
  {
    label: '同意',
    name: 'agree',
    icon: 'ep:circle-check',
  },
  {
    label: '退回',
    name: 'disagree',
    icon: 'ep:circle-close',
  },
];
const selected = ref('all');

const handleTabClick = (name) => {
  selected.value = name;
};
</script>

<template>
  <div class="todo-container">
    <el-input
      size="large"
      placeholder="搜索待办事项标题"
      :suffix-icon="Search"
    />
    <div class="tab">
      <el-button-group class="btn-group">
        <el-button
          v-for="btn in tabBtn"
          @click="handleTabClick(btn.name)"
          :class="selected === btn.name ? 'btn--select' : 'btn--unselected'"
          size="small"
          :key="btn.name"
        >
          <iconify-icon :icon="btn.icon"></iconify-icon>
          <span class="btn__label">{{ btn.label }}</span>
        </el-button>
      </el-button-group>
    </div>
    <label class="total">相关待办共计1项</label>
    <div class="cards" v-for="city in cities" :key="city">
      <item-container-card @click.prevent></item-container-card>
    </div>
  </div>
</template>

<style lang="scss" scoped>
.todo-container {
  padding: 20px 24px;

  .tab {
    display: flex;
    justify-content: end;
    align-items: center;
    margin-top: 23px;

    .btn-group {
      display: flex;
      align-items: center;
      width: 208px;
      height: 28px;
      background: #F2F2F2;
      border-radius: 3px;

      .btn--select {
        &:focus, &:hover, &:active {
          background-color: #fff;
          color: #000;
          outline: 0;
        }
      }

      .btn--unselected {
        background-color: transparent;
      }

      .btn__label {
        margin-left: 4px;
      }
    }
  }

  .total {
    margin-top: 25px;
    font-size: 12px;
    font-weight: 400;
    color: #989DA3;
    line-height: 55px;
  }

  .cards {
    margin-bottom: 17px;
  }
}
</style>
